﻿
using AntDesign;
using System;

public static class LoginInfo
{


    /// <summary>
    /// 用户Id
    /// </summary>
    public static string? UserId { get; set; }

    /// <summary>
    /// 用户名称
    /// </summary>
    public static string? UserName { get; set; }
    /// <summary>
    /// 登录时间
    /// </summary>
    public static DateTime LoginTime { get; set; }

    //private static readonly string Website = "localhost:5001";


}
public static class StringExtensions
{

    public static string API(this string str)
    {
        string[] strlist = str.Split(",", 2, StringSplitOptions.RemoveEmptyEntries);
        if (strlist[1].Length < 15 && !strlist[1].Any(c => IsSpecialCharacter(c)))
        {
            return $"{strlist[0]}/{strlist[1]}";
        }
        else
        {
            strlist[1] = strlist[1].Replace(",", "&");
            return $"{strlist[0]}?{strlist[1]}";
        }
    }
    public static string API(this string str, string parameter)
    {

        if (parameter.Length < 15 && !parameter.Any(c => IsSpecialCharacter(c)))
        {
            return $"{str}/{parameter}";
        }
        else
        {
            parameter = parameter.Replace(",", "&");
            return $"{str}?{parameter}";
        }
    }
    static bool IsSpecialCharacter(char c)
    {
        return c == '?' || c == '/' || c == ',' || c == '&';
    }
}
